<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
	<style type="text/css">
	  li{
	  list-style-type: none;
	  }
	</style>
<script src="${pageContext.request.contextPath}/calendar/WdatePicker.js"></script>
<script src="${pageContext.request.contextPath}/js/jquery-1.8.3.min.js"></script>
<script>
var flag = false;

function ckCardID() {
	var cardID = $("#cardID").val();
	if(cardID==null||$.trim(cardID)==""){
		flag=false;
		$("#spCardID").html("<font color='red'>卡号必填，不允许为空。<font>");
	}else{
		if (cardID != null && $.trim(cardID) != "") {
			$.post(
					"countCardID", 
					{"cardID" : cardID}, 
					function(n) {
						if (n > 0) {
							flag = false;
							$("#spCardID").html("<font color='red'>该卡号已经存在，请保证不重复换一个。</font>");
						} else {
							flag = true;
							$("#spCardID").html("<font color='green'>可用。</font>");
						}			
					}, 
					"JSON");
		}
	}
	
	return flag;
}
</script>
</head>

<body>
	<form action="addBank" method="post" onsubmit="return ckCardID()">
		<ul>
			<li>账户名称： <input name="customerName"/></li>
			<li>开户金额： <input name="currentMoney"/></li>
			<li>账户卡号： <input name="cardID" id="cardID" onblur="return ckCardID()"/>
			<span id="spCardID"></span></li>
			<li>开户日期： <input name="produceTime" id="produceTime" 
			onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
			readonly="readonly">
			<span id="ftProduceTime"></span></li>
			<li><input type="submit" value="开户"/></li>
		</ul>
	</form>
</body>
</html>
